<include file="__THEME__/public_header" />
<link href="__APP__/css/teacher.css" rel="stylesheet" type="text/css" />
<script  type="text/javascript" src="__APP__/js/rcalendar.js" ></script>
<div class="mask"></div>
<div class="page-palce">
	<div class="wrap"><a href="/">首页</a><span>&gt;</span><a href="{:U('classroom/Teacher')}">讲师</a><span>&gt;</span><span>{$data.name}</span></div>
</div>
<div class="page-top">
	<div class="wrap">
    	<div class="page-top-left">
        	<div class="pic"><img src="{:getCover($data['head_id'],180,180)}" class="lazyloading"></div>
            <div class="info">
            	<h3>
                	<div class="fl"><em>{$data.name}</em><if condition="$data['sex'] eq 1">男<else/>女</if></div>
                    <div class="star fl">
                        <span class= <if condition="$data.star GT 0">""<else />"no"</if>></span>
                        <span class= <if condition="$data.star GT 1">""<else />"no"</if>></span>
                        <span class= <if condition="$data.star GT 2">""<else />"no"</if>></span>
                        <span class= <if condition="$data.star GT 3">""<else />"no"</if>></span>
                        <span class= <if condition="$data.star GT 4">""<else />"no"</if>></span>
                    </div>
                </h3>
                <p>{$data.teach_evaluation}</p>
                <ul>
                	<li>
                    	<div class="name">教龄</div>
						<div class="num"><span>{$data.teacher_age}</span>年</div>
                    </li>
                    <li>
                    	<div class="name">课程</div>
						<div class="num"><span>{$data.course_count}</span>个</div>
                    </li>
                    <li>
                    	<div class="name">视频</div>
						<div class="num"><span>{$data.video_count}</span>个</div>
                    </li>
                    <li>
                    	<div class="name">预约</div>
						<div class="num"><span>{$data.reservation_count}</span>人</div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="page-top-right">
        	<ul>
            	<li>
                	<span class="sm"></span>
                    <p>实名认证</p>
                </li>
                <li>
                	<span class="zz"></span>
                    <p>资格认证</p>
                </li>
            </ul>
            <form class="form-box">
            	<p>价格：<span id="course-price"><if condition="$teacher_course[0]['course_price']">{$teacher_course[0]['course_price']}<else/>0</if></span>元 / 小时</p>
                <div class="form-item">
                	<select name="course" id="course" onchange="selectCourse();">
                	  <!--<option value="-1">请选择科目</option>-->
                	  <if condition="$teacher_course eq null">
                            <option value="0,0">暂无授课内容</option>
                      </if>
                     <foreach name="teacher_course" item="ld">
                            <option value="{$ld.course_price},{$ld.course_id}">{$ld.course_name}</option>
                     </foreach>
                	</select>
                </div>
                <div class="form-item">
                	<select id="teach_way">
                	  <option value="0">请选择授课方式</option>
                    <option value="1">在线授课</option>
                    <option value="2">线下授课</option>
                    <option value="3">线上/线下均可</option>
                	</select>
                </div>
                <div class="form-item"><a class="btn" onclick="charge();" href="javascript:void(0);">我要约课</a></div>
            </form>
        </div>
    </div>
</div>
<!--content start-->
<div class="content bgb pt10">
	<div class="wrap">
        <div class="content-con">
        	<div class="content-main">
            	<div class="page-title">
                	<ul class="page-title-ul">
                    	<li class="on"><a href="javascript:void(0);">基本资料</a></li>
                        <li><a href="javascript:void(0);">点评讲师</a></li>
                    </ul>
                </div>
                <div class="page-conent">
                	<dl class="teacher-info">
                        <dt><span class="icon-zl"></span>基本资料</dt>
                        <dd>
                        	<ul>
                                <li>教师职称:　{$data.title}</li>
                                <li>最高学历:　{$data.high_school}</li>
                                <li>毕业院校:　{$data.graduate_school}</li>
                                <li>授课方式:　<if condition="$teach_way eq 1">在线授课
                        <elseif condition="$teach_way eq 2"/>线下授课
                        <else/>线上/线下均可
                        </if></li>
                                <li>授课地区:　{$data.Teach_areas}</li>
                                <li>教师标签:　
                                   <?php 
                                        if($data["label"]){
                                            $label_list=explode(",", $data["label"]);
                                            foreach ($label_list as $key => $value) {
                                                echo "<label style='margin-right:8px;'>".$value."</label>";
                                            }
                                        }
                                    ?>
                                </li>
                                <li>基本简介:　{$data.inro}</li>
                                <li>教学特点:　{$data.teach_evaluation}</li>
                        	</ul>
                        </dd>
                    </dl>
                    <dl class="teacher-info">
                        <dt><span class="icon-nr"></span>授课内容</dt>
                        <if condition="$teacher_course eq null"><div style=\"margin-top:20px;\">还没有相应的授课内容</div><else />
                            <dd>
                                <foreach name="teacher_course" item="ld">
                                    <h3>{$ld.course_name}(价格:{$ld.course_price}/小时)</h3>{$ld.course_inro}
                                </foreach>
                            </dd>
                        </if>
                    </dl>
                </div>
                <div class="page-conent" style="display: none;">
                	<div class="big">
                        <div>综合评分</div>
                        <div class="star">
                            <span class= <if condition="$data.star GT 0">""<else />"no"</if>></span>
                            <span class= <if condition="$data.star GT 1">""<else />"no"</if>></span>
                            <span class= <if condition="$data.star GT 2">""<else />"no"</if>></span>
                            <span class= <if condition="$data.star GT 3">""<else />"no"</if>></span>
                            <span class= <if condition="$data.star GT 4">""<else />"no"</if>></span>
                        </div>
                        <div>（{$data.review_count}人）</div>
                    </div>
                    <div id="page-conent-data">
                    </div>
                    <div style="width:auto;float:left;margin-right:20px;">
                        <select name="course" id="course_id" style="margin-bottom:10px;width:100px;height:30px;">
                            <option value="0">请选择课程</option>
                            <foreach name="teacher_course" item="ld">
                                <option value="{$ld.course_id}">{$ld.course_name}</option>
                            </foreach>
                        </select>
                    </div>
                    <label class="form-label color_hui  fl" for="score">评分：</label>
                    <ul class="star_ul fl" style="margin-right:30px;">
                      <li class="grade-back-default" style="cursor:pointer;" onclick="selectstar(this,1);"></li>
                      <li class="grade-back-default" style="cursor:pointer;" onclick="selectstar(this,2);"></li>
                      <li class="grade-back-default" style="cursor:pointer;" onclick="selectstar(this,3);"></li>
                      <li class="grade-back-default" style="cursor:pointer;" onclick="selectstar(this,4);"></li>
                      <li class="grade-back-default" style="cursor:pointer;" onclick="selectstar(this,5);"></li>
                      <input type="hidden" id="star">
                    </ul> 
                    <label style="margin-right:30px;">授课技巧：
                        <select name="skill" id="skill" style="margin-left:10px;">
                            <option value="0">请选择</option>
                            <option value="1">优</option>
                            <option value="2">良</option>
                            <option value="3">好</option>
                        </select>
                    </label>
                    <label style="margin-right:30px;">专业知识：
                        <select name="Professional" id="Professional" style="margin-left:10px;">
                            <option value="0">请选择</option>
                            <option value="1">优</option>
                            <option value="2">良</option>
                            <option value="3">好</option>
                        </select>
                    </label>
                    <label style="margin-right:30px;">教学态度：
                        <select name="attitude" id="attitude" style="margin-left:10px;">
                            <option value="0">请选择</option>
                            <option value="1">优</option>
                            <option value="2">良</option>
                            <option value="3">好</option>
                        </select>
                    </label>
                    <textarea name="description" id="description" class="v-textarea"></textarea>
                    <div style="width:85%;height:35px; margin-top:10px;margin-bottom:30px;">
                        <input type="button" class="t-btn-1" onclick="return addreview();" value="发表" /><br/>
                    </div>
                </div>
            </div>
            <div class="content-sider w340">
                <div class="sider-tit">一周授课时间</div>
				<div class="weekday">
                	<table width="100%" border="0">
                        
                        <tr>
                            <foreach name="teacher_schedule" item="ld">
                                <th class="td" style="font-size:16px;">{$ld.title}</th>
                            </foreach>
                        </tr>
                        <foreach name="teacher_level" item="ld">
                        <tr>
                            <foreach name="ld" item="val">
                                <td><?php 
                                    if(in_array($val["id"],$data["teacher_schedule"])){
                                        echo "<span class='icon-have'></span>";
                                    }
                                ?></td>
                            </foreach>
                        </tr>
                        </foreach>
                    </table>
				</div>
                <div class="sider-tit">课程推荐</div>
                <ul class="sider-class">
                    <volist name="recClass" id="vo">
                    <li>
                    	<div class="pic"><a href="{:U('classroom/Video/view',array('id'=>$vo['id']))}"><img src="{:getCover($vo['cover'] ,112,70)}" class="lazyloading"></a></div>
                        <div class="info">
                        	<div class="tit"><a href="{:U('classroom/Video/view',array('id'=>$vo['id']))}">{$vo.video_title}</a></div>
							<div class="txt">{$vo.name}</div>
                        </div>
                    </li>
                    </volist>
                </ul>
                <div class="new-actives">
                    <div class="sider-tit tab-hd">
                    	名师推荐
                        <span class="pageState"></span>
                        <span class="step">
                              <a href="javascript:void(0)" class="prev"><s class="arrow arrow-lthin"><s></s></s></a>
                              <a href="javascript:void(0)" class="next"><s class="arrow arrow-rthin"><s></s></s></a>
                        </span>
                    </div>
                    <div class="tab-bd">
                    	<div class="tab-bd-in">
                            <volist name="recTeacher" id="vo">
                            <dl class="sider-teacher">
                                <dt><a href="{:U('classroom/Teacher/view',array('id'=>$vo['id']))}"><img src="{:getCover($vo['head_id'],60,60)}"></a></dt>
                                <dd>
                                    <h3><a href="{:U('classroom/Teacher/view',array('id'=>$vo['id']))}">{$vo.name}</a></h3>
                                    <p>{$vo.inro}</p>
                                </dd>
                            </dl>
                            </volist>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 购买确认弹出框 -->
<div class="buyOperating">
    <div class="w-close"><a class="mr15 mt5">×</a></div>
    <div class="w-notice">
        <h4>提示：该课程需要支付<em class="coin_num_l" id="price"></em>学币，您当前账户余额为<em class="coin_num_l">{$data['balance']['balance']}</em>学币。是否继续？</h4>
    </div>
    <div class="agreement">
        <a><span id="protocol" class="agree"></span>我已经阅读并同意</a>
        <a>《收费课程服务协议》</a>
    </div>
    <div class="buy-btn">
        <a class="btn"  onclick="buyOperat();">确认支付</a>
        <a class="btn" href="{:U('classroom/User/recharge')}">充值</a>
        <a class="btn cancel">暂不支付</a>
    </div>
</div>
<script>
function charge(){
    course=$("#course").val();
    arrayList = course.split(",",2);
    teach_way=$("#teach_way").val();
    if(teach_way==0){
        ui.error("请选择授课方式");
        return false;
    }
    //点击购买
    if(MID<=0){
        reg_login();
        return false;
    }
    $("#price").html(arrayList[0]);
    $('.buyOperating').show();
    var mask_height = $(document).height();
	$('.mask').height(mask_height).show();
}
function selectCourse(){
    var course =$("#course").val();
    var arrayList = course.split(",",2);
    $("#course-price").html(arrayList[0]);
}
//追加html
    function appendHtml(data){
        $(".more").remove();
        $("#page-conent-data").append(data.data);
        if(data.nowPage+1>data.totalPages){
            return;
        }else{
            var html="<div class=\"more\" style=\"margin:0 auto 20px auto;\" ><a href=\"javascript:void(0)\" id=\"getList\">查看更多</a></div>"
            $("#page-conent-data").append(html);
            p=data.nowPage+1;//下一页
        }
    }
        function buyOperat(){
        var course =$("#course").val();
        var arrayList = course.split(",",2);
        var teach_way=$("#teach_way").val();
        var teacher_id="<?php echo $data['id'] ?>";
        var course_price=arrayList[0];
        var course_id=arrayList[1];
        $.post(U('classroom/Teacher/buyCourse'),{teacher_id:teacher_id,teach_way:teach_way,course_price:course_price,course_id:course_id},function(txt){
            if(txt.status == '0'){
                $(".buyOperating").hide();
                $("#charge").attr('id','');
                notes(txt.info,'failure');
            } else {
                $(".buyOperating").hide();
                $("#charge").attr('id','');
                notes(txt.info,'success');
                window.location.href = window.location.href;
            }
        },'json');
    }
    function selectstar(cate,star){
        if(star<2){
            $(cate).parent().children().attr("class","grade-back-default");
            $(cate).attr("class","grade-back-set");
        }else{
            $(cate).parent().children().attr("class","grade-back-default");
            $(cate).prevAll().attr("class","grade-back-set");
            $(cate).attr("class","grade-back-set");
        }
        $("#star").val(star);
    } 
    //请求事件
    function ajaxBang(){
        $.ajax({
            type: "GET",
            url:"{:U('classroom/Teacher/getTeachNote')}",
            data:"p="+p,
            dataType:"json",
            success:function(data){
                appendHtml(data);
            }
        });
    }
    function addreview(){
        var teacher_id="<?php echo $data['id'] ?>";
        var uid = '{$uid}';
        if(uid<=0){
            reg_login();
            return false;
        }else{
            id=$("#course_id").val();
            description=$("#description").val();
            skill=$("#skill").val();
            Professional=$("#Professional").val();
            attitude=$("#attitude").val();
            star=$("#star").val();
            if(id==0){
                alert("请选择课程!");
                return false;
            }
            if(description==""){
                alert("请填写评论!");
                return false;
            }
            if(skill==0){
                alert("请选择授课技巧!");
                return false;
            }
            if(Professional==0){
                alert("请选择专业知识!");
                return false;
            }
            if(attitude==0){
                alert("请选择教学态度!");
                return false;
            }
            $.post(U('classroom/Teacher/addreview'),{id:id,teacher_id:teacher_id,description:description,skill:skill,Professional:Professional,attitude:attitude,star:star},function(txt){
                if(txt.status == 0){
                    ui.error(txt.info);
                } else {
                    ui.success(txt.info);
                    $(".mina-list-zj").html("");
                    $(function(){
                        var id="{$data.id}";
                        $.ajax({
                            type: "GET",
                            url:"{:U('classroom/Teacher/getTeachNote')}",
                            data:"p=1"+"&id="+id,
                            dataType:"json",
                            success:function(data){
                                appendHtml(data);
                            }
                        });
                    });
                }
            },'json');
        }
    }  
$(function(){
    //标签切换
   $(".page-title-ul li").click(function(){
    var _this = $(this);
        _this.addClass('on').siblings().removeClass('on');
        $(".page-conent:eq("+_this.index()+")").show().siblings(".page-conent").hide();
   }); 
    //查看更多点击事件
    $("#getList").live("click",
        function(){
            ajaxBang();
        }
    );
   //获取点评
   var id="{$data.id}";
    $.ajax({
        type: "GET",
        url:"{:U('classroom/Teacher/getTeachNote')}",
        data:"p=1"+"&id="+id,
        dataType:"json",
        success:function(data){
            appendHtml(data);
        }
    });
    //暂不支付
    $('.w-close a,.buy-btn .cancel').click(function(){
        $('.buyOperating,.mask').hide();
    });
    

});
</script>
<script src="__APP__/js/jquery.SuperSlide.2.1.1.js"></script>
<script src="__APP__/js/script.js"></script>
<include file="__THEME__/public_footer" />